<?php

namespace app\adminapi\validate;

use app\common\validate\BaseValidate;

class SysFileValidate extends BaseValidate
{
    protected $rule = [
        'pageNo' => 'regex:/^([1-9]\d*)$/',
        'pageSize' => ['regex' => '/^(-1|[1-9]\d*)$/'],
        'cid' => 'require|number',
        'type' => 'require|number|in:1,2,3',
        'id' => 'require',
        'name' => 'require',
        'ids' => 'require'
    ];

    protected $message = [
        'pageNo.regex' => '分页页码只能是数字',
        'pageSize.regex' => '分页页大小只能是数字',
        'cid.require' => '请输入文件分类ID',
        'cid.number' => '文件分类ID参数错误',
        'type.require' => '请输入文件类型',
        'type.number' => '文件类型参数错误',
        'type.in' => '文件类型不合法',
        'id.require' => '文件参数不完整',
        'name.require' => '请输入文件名',
        'ids.require' => '参数不完整'
    ];

    protected $scene = [
        'list' => ['pageNo', 'pageSize'],
        'upload' => ['cid', 'type'],
        'rename' => ['id', 'name'],
        'query' => ['id'],
        'move' => ['ids', 'cid'],
        'delete' => ['ids']
    ];
}